//
//  DesignCode.swift
//  PropertyCommunity
//
//  Created by benwang on 2021/6/24.
//

import Foundation

struct ProductTest<Base> {
    let base: Base
    init(_ base: Base) {
        self.base = base
    }
}

protocol ProductTestCompatible {
    associatedtype WrapperType
    var pt: WrapperType { get }
    static var pt: WrapperType.Type { get }
}

extension ProductTestCompatible {
    var pt: ProductTest<Self> {
        return ProductTest(self)
    }
    static var pt: ProductTest<Self>.Type {
        return ProductTest.self
    }
}

import class Foundation.NSObject

/// 拓展所有NSObject都可用'pt'访问属性
extension NSObject: ProductTestCompatible {}
